package com.bestow.basic.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bestow.common.annotation.Log;
import com.bestow.common.core.controller.BaseController;
import com.bestow.common.core.domain.AjaxResult;
import com.bestow.common.enums.BusinessType;
import com.bestow.basic.domain.HlsDocFileParaTable;
import com.bestow.basic.service.IHlsDocFileParaTableService;
import com.bestow.common.utils.poi.ExcelUtil;
import com.bestow.common.core.page.TableDataInfo;

/**
 * 格参数集Controller
 *
 * @author liliu
 * @date 2022-10-05
 */
@RestController
@RequestMapping("/basic/docFileParaTable")
public class HlsDocFileParaTableController extends BaseController {
    @Autowired
    private IHlsDocFileParaTableService hlsDocFileParaTableService;

    /**
     * 查询格参数集列表
     */
    @PreAuthorize("@ss.hasPermi('basic:docFileParaTable:list')")
    @GetMapping("/list")
    public TableDataInfo list(HlsDocFileParaTable hlsDocFileParaTable) {
        startPage();
        List<HlsDocFileParaTable> list = hlsDocFileParaTableService.selectHlsDocFileParaTableList(hlsDocFileParaTable);
        return getDataTable(list);
    }

    /**
     * 导出格参数集列表
     */
    @PreAuthorize("@ss.hasPermi('basic:docFileParaTable:export')")
    @Log(title = "格参数集", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HlsDocFileParaTable hlsDocFileParaTable) {
        List<HlsDocFileParaTable> list = hlsDocFileParaTableService.selectHlsDocFileParaTableList(hlsDocFileParaTable);
        ExcelUtil<HlsDocFileParaTable> util = new ExcelUtil<HlsDocFileParaTable>(HlsDocFileParaTable.class);
        util.exportExcel(response, list, "格参数集数据");
    }

    /**
     * 获取格参数集详细信息
     */
    @PreAuthorize("@ss.hasPermi('basic:docFileParaTable:query')")
    @GetMapping(value = "/{paraTableId}")
    public AjaxResult getInfo(@PathVariable("paraTableId") Long paraTableId) {
        return AjaxResult.success(hlsDocFileParaTableService.selectHlsDocFileParaTableByParaTableId(paraTableId));
    }

    /**
     * 新增格参数集
     */
    @PreAuthorize("@ss.hasPermi('basic:docFileParaTable:add')")
    @Log(title = "格参数集", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HlsDocFileParaTable hlsDocFileParaTable) {
        return toAjax(hlsDocFileParaTableService.insertHlsDocFileParaTable(hlsDocFileParaTable));
    }

    /**
     * 修改格参数集
     */
    @PreAuthorize("@ss.hasPermi('basic:docFileParaTable:edit')")
    @Log(title = "格参数集", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HlsDocFileParaTable hlsDocFileParaTable) {
        return toAjax(hlsDocFileParaTableService.updateHlsDocFileParaTable(hlsDocFileParaTable));
    }

    /**
     * 删除格参数集
     */
    @PreAuthorize("@ss.hasPermi('basic:docFileParaTable:remove')")
    @Log(title = "格参数集", businessType = BusinessType.DELETE)
    @DeleteMapping("/{paraTableIds}")
    public AjaxResult remove(@PathVariable Long[] paraTableIds) {
        return toAjax(hlsDocFileParaTableService.deleteHlsDocFileParaTableByParaTableIds(paraTableIds));
    }
}
